<template>
  <view class="sotre-check">
    <!-- 基础信息 -->
    <view class="basic-information clearfix">
      <view class="title">基础信息</view>
      <view class="item border-style">
        <view class="label">店面名称：</view>
        <view class="store-name">{{ storeName }}</view>
      </view>
      <view class="item cust-name-type">
        <view class="label">店面类型：</view>{{ storeType }}
      </view>
      <view class="item cust-name">
        <view class="label">助店人员：</view>{{ custName }}
      </view>
    </view>

    <!-- 助店任务 直营 动态 -->
    <view
      class="basic-information"
      v-if="taskConfigList.length > 0"
      :class="taskDynamicShow ? 'sample-management-act' : ''"
    >
      <view class="title">
        助店任务
        <view
          class="fold"
          :class="!taskDynamicShow ? 'fold-active' : ''"
          @click="taskDynamicShowFun()"
        ></view>
      </view>
      <template v-if="!taskDynamicShow">
        <view
          class="task-content"
          v-for="(item, index) in taskConfigList"
          :key="index"
        >
          <view class="title">{{ item.taskName }}</view>

          <view class="item upload-item">
            <view class="label">图片：</view>
            <view class="upload-img-box">
              <template v-if="item.pics.length > 0">
                <view
                  class="view-upload-item"
                  v-for="(items, indexs) in item.pics"
                  :key="items.url"
                >
                  <image
                    :src="items.url"
                    @tap.stop="imgPreConfigView(item.configId, indexs)"
                  ></image>
                  <image
                    src="../../static/cancel.png"
                    class="cancel-btn"
                    @tap.stop="
                      deleteFileConfigFn(item.configId, indexs, 'pics')
                    "
                  >
                  </image>
                </view>
              </template>
              <view
                class="view-upload-btn"
                @tap.stop="uploadImgConfigFn(item.configId)"
              ></view>
            </view>
          </view>
          <view class="item upload-item">
            <view class="label">视频：</view>
            <view class="upload-img-box">
              <template v-if="item.videos.length > 0">
                <view
                  class="view-upload-item"
                  v-for="(items, indexs) in item.videos"
                  :key="items.url"
                >
                  <video
                    :src="items.url"
                    objectFit="fill"
                    :initial-time="1"
                    controls
                  ></video>
                  <view
                    class="my-video-bg"
                    @tap.stop="showVideoFn(items.url)"
                  ></view>
                  <image
                    src="../../static/cancel.png"
                    class="cancel-btn"
                    @tap.stop="
                      deleteFileConfigFn(item.configId, indexs, 'videos')
                    "
                  ></image>
                </view>
              </template>
              <view
                class="view-upload-btn"
                @tap.stop="uploadVideoConfigFn(item.configId)"
              ></view>
            </view>
          </view>
          <view class="item upload-item remark-item">
            <view class="label">
              <view
                v-if="verificationSwitch"
                style="color: red; padding-right: 4rpx"
                >*</view
              >备注：
            </view>
            <u-input
              v-model="item.remark"
              type="textarea"
              class="my-form-textarea"
              placeholder="完成情况描述…"
              :border="false"
              :auto-height="true"
              maxlength="400"
              @focus="handleFocus"
              @blur="handleBlur"
            />
          </view>
          <view class="item item-subtitle">
            <view class="label">
              <view
                v-if="verificationSwitch"
                style="color: red; padding-right: 4rpx"
                >*</view>
              是否生成待办：</view>
            <u-radio-group v-model="item.isGenerate">
              <u-radio
                shape="circle"
                v-for="(itemu) in list"
                :key="itemu.value"
                :label="itemu.name"
                :name="itemu.value"
                @change="(e) => onDirectTodoChange(e, item)"
              >
                {{ itemu.name }}
              </u-radio>
            </u-radio-group>
          </view>
          <!-- 待办处理人 -->
          <view class="item remark-item" v-if="item.isGenerate === 'Y'">
            <view class="label">
              <view
                style="color: red; padding-right: 4rpx"
                >*</view
              >待办处理人：
            </view>
            <u-input
              v-model="item.handlerName"
              class="custom-field"
              placeholder="请选择人员"
              type="select"
              @click="selectEnterpriseContact(item)"
            />
          </view>
          <!-- 以及完成时间 -->
          <view class="item remark-item" v-if="item.isGenerate === 'Y'">
            <view class="label">
              <view
                style="color: red; padding-right: 4rpx"
                >*</view
              >预计完成时间：
            </view>
            <u-input
              v-model="item.planCompletionTime"
              class="custom-field"
              placeholder="请选择时间"
              type="select"
              @click="handleCompletionTimeClick(item)"
            />
          </view>
        </view>
      </template>
    </view>

    <!-- item.father.dictValue == 'XD_TASK_BRAND' ? 'sample-management' :  -->
    <view
      class="basic-information"
      :class="
        !item.father.sampleFoldExpand
          ? 'sample-management-act'
          : item.father.dictValue == 'XD_TASK_DOTR'
          ? 'sample-management-dotr'
          : ''
      "
      v-for="(item, index) in fixedTasks"
      :key="index"
    >
      <view class="title">
        <view style="display: flex;align-items: center">
          <view v-if="item.father.dictValue == 'XD_TASK_DOTR'" style="color: red; padding-right: 4rpx">*</view>
          <view>{{ item.father.dictName }}</view>
        </view>
        <u-radio-group
          class="custom-stype"
          v-if="item.father.dictValue == 'XD_TASK_DOTR'"
          active-color="rgb(52,127,203)"
          v-model="item.isEnableName"
        >
          <u-radio
            shape="circle"
            v-for="(itemu, indexu) in list"
            :key="indexu"
            :label="itemu.name"
            :name="itemu.name"
            @change="(e) => onChangeMarkChoose(e, item.father)"
          >
            {{ itemu.name }}
          </u-radio>
        </u-radio-group>
        <view
          v-if="item.father.dictValue != 'XD_TASK_DOTR'"
          class="fold"
          :class="!item.father.sampleFoldExpand ? 'fold-active' : ''"
          @click="sampleManagFoldFun(index)"
        ></view>
      </view>
      <!-- 加盟 -->
      <template v-if="item.father.sampleFoldExpand">
        <template v-for="items in item.childs">
          <view class="item item-subtitle">
            <view class="label">{{ items.dictName }}：</view>
            <u-radio-group
              v-if="item.father.dictValue != 'XD_TASK_BRAND'"
              active-color="rgb(52,127,203)"
              v-model="items.isEnableName"
            >
              <u-radio
                shape="circle"
                v-for="(itemu, indexu) in list"
                :key="indexu"
                :label="itemu.name"
                :name="itemu.name"
                @change="(e) => onChangeMarkChoose(e, items)"
              >
                {{ itemu.name }}
              </u-radio>
            </u-radio-group>
          </view>

          <view
            :key="items.dictValue"
            :class="
              item.father.dictValue == 'XD_TASK_BRAND' ? 'xdtaskbrand' : ''
            "
            v-if="computeIsHasQuantity(items, item)"
          >
            <!-- 数量 -->
            <view
              class="item"
              v-if="
                items.dictValue != 'XD_TASK_XIXX_0' &&
                items.dictValue != 'XD_TASK_XIXX_1' &&
                items.dictValue != 'XD_TASK_XIXX_2' &&
                item.father.dictValue != 'XD_TASK_BRAND'
              "
            >
              <view class="label">
                <view
                  v-if="verificationSwitch"
                  style="color: red; padding-right: 4rpx"
                  >*</view
                >数量：
              </view>
              <u-number-box
                id="numberBox"
                bg-color="#ffffff"
                color="#333333"
                :min="1"
                size="24"
                v-model="items.quantity"
                @change="byNumberChange"
              >
              </u-number-box>
            </view>

            <!-- 图片 -->
            <view
              class="item upload-item"
              v-if="
                items.dictValue != 'XD_TASK_XIXX_0' &&
                items.dictValue != 'XD_TASK_XIXX_1' &&
                items.dictValue != 'XD_TASK_XIXX_2' &&
                item.father.dictValue != 'XD_TASK_BRAND'
              "
            >
              <view class="label">图片：</view>
              <view class="upload-img-box">
                <template v-if="items.pics.length > 0">
                  <view
                    class="view-upload-item"
                    v-for="(itemss, indexss) in items.pics"
                    :key="itemss.url"
                  >
                    <image
                      :src="itemss.url"
                      @tap.stop="imgPreview(items.dictValue, indexss)"
                    ></image>
                    <image
                      src="../../static/cancel.png"
                      class="cancel-btn"
                      @tap.stop="deleteFileFn(items.dictValue, indexss, 'pics')"
                    ></image>
                  </view>
                </template>
                <view
                  class="view-upload-btn"
                  @tap.stop="uploadImgFn(items.dictValue)"
                ></view>
              </view>
            </view>

            <!-- 视频 -->
            <view
              class="item upload-item"
              v-if="
                items.dictValue != 'XD_TASK_XIXX_0' &&
                items.dictValue != 'XD_TASK_XIXX_1' &&
                items.dictValue != 'XD_TASK_XIXX_2' &&
                item.father.dictValue != 'XD_TASK_BRAND'
              "
            >
              <view class="label">视频：</view>
              <view class="upload-img-box">
                <template v-if="items.videos.length > 0">
                  <view
                    class="view-upload-item"
                    v-for="(itemss, indexss) in items.videos"
                    :key="indexss"
                  >
                    <video
                      :src="itemss.url"
                      objectFit="fill"
                      :initial-time="1"
                      controls
                    ></video>
                    <view
                      class="my-video-bg"
                      @tap.stop="showVideoFn(itemss.url)"
                    ></view>
                    <image
                      src="../../static/cancel.png"
                      class="cancel-btn"
                      @tap.stop="
                        deleteFileFn(items.dictValue, indexss, 'videos')
                      "
                    ></image>
                  </view>
                </template>
                <view
                  class="view-upload-btn"
                  @tap.stop="uploadVideoFn(items.dictValue)"
                ></view>
              </view>
            </view>

            <!-- 备注 -->
            <view
              class="item upload-item remark-item"
              v-if="
                items.dictValue != 'XD_TASK_BRAND_0' &&
                items.dictValue != 'XD_TASK_BRAND_3'
              "
            >
              <view class="label">
                <view
                  style="color: red; padding-right: 4rpx"
                  v-if="
                    item.father.dictValue != 'XD_TASK_BRAND' &&
                    verificationSwitch
                  "
                  >*</view
                >备注：
              </view>
              <u-input
                v-if="items.dictValue == 'XD_TASK_XIXX_0'"
                v-model="items.remark"
                placeholder="缺XX员工代码"
                type="textarea"
                class="my-form-textarea"
                :border="false"
                :auto-height="true"
                maxlength="400"
                @focus="handleFocus"
                @blur="handleBlur"
              />
              <u-input
                v-else-if="items.dictValue == 'XD_TASK_XIXX_2'"
                v-model="items.remark"
                placeholder="缺XX店员离职，相关人员信息及系统配置关闭"
                type="textarea"
                class="my-form-textarea"
                :border="false"
                :auto-height="true"
                maxlength="400"
                @focus="handleFocus"
                @blur="handleBlur"
              />
              <u-input
                v-if="
                  items.dictValue != 'XD_TASK_XIXX_0' &&
                  items.dictValue != 'XD_TASK_XIXX_2'
                "
                v-model="items.remark"
                type="textarea"
                class="my-form-textarea"
                placeholder="完成情况描述…"
                :border="false"
                :auto-height="true"
                maxlength="400"
                @focus="handleFocus"
                @blur="handleBlur"
              />
            </view>

            <!-- 预计完成时间 -->
						 <!-- 样品管理、产品二维码、价签三大类需要填写 -->
            <view class="item remark-item" v-if="['XD_TASK_YPGL', 'XD_TASK_XPGL', 'XD_TASK_CPEWM', 'XD_TASK_CPBQ', 'XD_TASK_XTXX'].includes(item.father.dictValue)">
              <view class="label">
                <view
                  v-if="verificationSwitch"
                  style="color: red; padding-right: 4rpx"
                  >*</view
                >预计完成时间：
              </view>
              <u-input
              	v-model="items.planCompletionTime"
              	class="custom-field"
              	placeholder="请选择时间"
              	type="select"
              	@click="handleCompletionTimeClick(items)"
              />
            </view>
            <!-- 系统(微客+聚单宝)使用是否熟练 -->
            <!-- <template v-if="items.dictValue == 'XD_TASK_XIXX_1'">
						<view class="problem-item" v-for="(item,index) in keyTaskList" :key="index">
							<delSlideLeft :item="item" :data_transit="{index:index,item:item}"  @click="removeActivity('XD_TASK_XIXX_1',index)">
								<input class="input-item" type="type" v-model="item.value" @focus="handleFocus" @blur="handleBlur" />
							</delSlideLeft>
						</view>
						<view class="add-problem" @click="addActivity('XD_TASK_XIXX_1')"><view class="add-problem-icon"></view>新增</view>
					</template> -->

            <!-- 开业及活动支持 -->
            <template v-if="items.dictValue == 'XD_TASK_BRAND_0'">
              <view
                class="problem-item"
                v-for="(item, index) in brandTaskList"
                :key="index"
              >
                <delSlideLeft
                  :item="item"
                  :data_transit="{ index: index, item: item }"
                  @delItem="removeActivity('XD_TASK_BRAND_0', index)"
                >
                  <input
                    class="input-item"
                    type="type"
                    v-model="item.value"
                    @focus="handleFocus"
                    @blur="handleBlur"
                  />
                </delSlideLeft>
              </view>
              <view class="add-problem" @click="addActivity('XD_TASK_BRAND_0')">
                <view class="add-problem-icon"></view>新增
              </view>
            </template>

            <!-- 合同签署 -->
            <view
              class="item upload-item"
              v-if="items.dictValue == 'XD_TASK_BRAND_3'"
            >
              <view class="label">附件：</view>
              <view class="upload-img-box">
								<template v-if="items.files.length > 0">
									<view
										class="view-upload-item"
										v-for="(itemss, indexss) in items.files"
										:key="itemss.url"
									>
										<!-- <view class="files-wrap" v-if="itemss.url.includes('.pdf')">
										<view class="click-wrap" @tap.stop="imgPreFileImgs(items.dictValue, itemss.url)"></view>
										<ss-preview :fileUrl="itemss.url" fileType="2"></ss-preview>
									</view> -->
										<view
											v-if="itemss.url.includes('.pdf')"
											:fileUrl="itemss.url"
											fileType="2"
											@tap.stop="imgPreFiles(itemss.url)"
										>
										</view>
										<image
											v-else
											:src="itemss.url"
											@tap.stop="imgPreFileImgs(items.dictValue, itemss.url)"
										></image>

										<image
											src="../../static/cancel.png"
											class="cancel-btn"
											@tap.stop="deleteFileFn(items.dictValue, indexss, 'file')"
										></image>
									</view>
								</template>
                <view
                  class="view-upload-btn"
                  @tap.stop="uploadFileFn(items.dictValue)"
                ></view>
              </view>
            </view>
          </view>
        </template>
      </template>

      <!-- 直营 已解决/待解决问题反馈 固定 -->
      <view
        v-if="
          item.father.dictValue == 'XD_TASK_QUESTION' &&
          item.father.sampleFoldExpand
        "
        style="margin-top: 20rpx"
      >
        <view
          class="problem-item"
          v-for="(item, index) in questionTaskList"
          :key="index"
        >
          <delSlideLeft
            :item="item"
            :data_transit="{ index: index, item: item }"
            @delItem="removeActivity('XD_TASK_QUESTION', index)"
          >
            <input
              class="input-item"
              type="type"
              v-model="item.value"
              @focus="handleFocus"
              @blur="handleBlur"
            />
          </delSlideLeft>
        </view>
        <template v-if="questionTaskList && questionTaskList.length > 0">
          <view class="item item-subtitle">
            <view class="label">
              <view v-if="isHasQuestion" style="color: red; padding-right: 4rpx"
                >*</view>
              是否生成待办：</view>
            <u-radio-group v-model="questionTodo.isGenerate">
              <u-radio
                shape="circle"
                v-for="(itemu) in list"
                :key="itemu.value"
                :label="itemu.name"
                :name="itemu.value"
                @change="(e) => onDirectTodoChange(e, questionTodo)"
              >
                {{ itemu.name }}
              </u-radio>
            </u-radio-group>
          </view>
          <!-- 待办处理人 -->
          <view class="item remark-item" v-if="questionTodo.isGenerate === 'Y'">
            <view class="label">
              <view
                style="color: red; padding-right: 4rpx"
                >*</view>待办处理人：
            </view>
            <u-input
              v-model="questionTodo.handlerName"
              class="custom-field"
              placeholder="请选择人员"
              type="select"
              @click="selectEnterpriseContact(questionTodo)"
            />
          </view>
          <!-- 以及完成时间 -->
          <view class="item remark-item" v-if="questionTodo.isGenerate === 'Y'">
            <view class="label">
              <view
                style="color: red; padding-right: 4rpx"
                >*</view
              >预计完成时间：
            </view>
            <u-input
              v-model="questionTodo.planCompletionTime"
              class="custom-field"
              placeholder="请选择时间"
              type="select"
              @click="handleCompletionTimeClick(questionTodo)"
            />
          </view>
        </template>
        <view class="add-problem" @click="addActivity('XD_TASK_QUESTION')">
          <view class="add-problem-icon"></view>新增
        </view>
      </view>

      <!-- 是否培训 固定-->
      <template
        v-if="item.father.dictValue == 'XD_TASK_DOTR' && item.isEnable == 1"
      >
        <!-- 图片 -->
        <view class="item upload-item">
          <view class="label">图片：</view>
          <view class="upload-img-box">
						<template v-if="trainChilds.pics.length > 0">
							<view
								class="view-upload-item"
								v-for="(item, index) in trainChilds.pics"
								:key="item.url"
							>
								<image
									:src="item.url"
									@tap.stop="imgPreview('trainChildsImg', index)"
								></image>
								<image
									src="../../static/cancel.png"
									class="cancel-btn"
									@tap.stop="deleteFileFn('trainChildsImg', index, 'pics')"
								></image>
							</view>
						</template>
            <view
              class="view-upload-btn"
              @tap.stop="uploadImgFn('trainChildsImg')"
            ></view>
          </view>
        </view>

        <!-- 视频 -->
        <view class="item upload-item">
          <view class="label">视频：</view>
          <view class="upload-img-box">
						<template v-if="trainChilds.videos.length > 0">
							<view
								class="view-upload-item"
								v-for="(item, index) in trainChilds.videos"
								:key="item.url"
							>
								<video
									:src="item.url"
									objectFit="fill"
									:initial-time="1"
									controls
								></video>
								<view
									class="my-video-bg"
									@tap.stop="showVideoFn(item.url)"
								></view>
								<image
									src="../../static/cancel.png"
									class="cancel-btn"
									@tap.stop="deleteFileFn('trainChildsVideo', index, 'videos')"
								></image>
							</view>
						</template>
            <view
              class="view-upload-btn"
              @tap.stop="uploadVideoFn('trainChildsVideo')"
            ></view>
          </view>
        </view>

        <!-- 备注 -->
        <view class="item upload-item" style="margin-top: 30rpx">
          <view class="label">
            <view
              v-if="verificationSwitch"
              style="color: red; padding-right: 4rpx"
              >*</view
            >备注：
          </view>
          <u-input
            placeholder="完成情况描述"
            v-model="xdTaskDotr"
            type="textarea"
            class="my-form-textarea"
            :border="false"
            :auto-height="true"
            maxlength="400"
            @focus="handleFocus"
            @blur="handleBlur"
          />
        </view>
      </template>
    </view>

    <view class="placeholder-view"></view>
    <!-- 取消 确定按钮 v-if="!fixedWrapBtn" -->
    <view class="operation-btn">
      <view class="cancel-oper" @click="cancelOrder()">取消</view>
      <view class="confirm-oper" @click="SubmitConfirm()">确定</view>
    </view>

    <!-- 取消 确认弹框组件 -->
    <u-popup
      v-model="isPopupShowEmpty"
      mode="center"
      border-radius="10"
      width="70%"
      @close="isPopupShowEmpty = false"
      class="popBox"
    >
      <view class="slot-content"> 取消后您所填写的内容将清空，是否取消 </view>
      <!-- 弹框底部按钮 -->
      <view class="btn-group">
        <u-button @click="emptyConfirm()">是</u-button>
        <u-button @click="isPopupShowEmpty = false">否</u-button>
      </view>
    </u-popup>

    <!-- 视频放大 -->
    <view
      class="show-video-box"
      v-if="showVideoUrl.length > 0"
      @tap.stop="closeVideoFn()"
    >
      <view class="show-video-box-bd" @tap.stop="closeVideoFn()">
        <video
          id="myVideo"
          :src="showVideoUrl"
          :autoplay="true"
          controls
          :show-fullscreen-btn="true"
          @tap.stop="closeVideoFn()"
        ></video>
        <view class="close-show-video-btn" @tap.stop="closeVideoFn()"></view>
      </view>
    </view>

    <!-- 确定 确认弹框组件 -->
    <u-popup
      v-model="isPopupShowSubmit"
      mode="center"
      border-radius="10"
      width="70%"
      @close="isPopupShowSubmit = false"
      class="popBox"
    >
      <view class="slot-content"> 针对本次助店打卡任务项您是否确认 </view>
      <!-- 弹框底部按钮 -->
      <view class="btn-group">
        <u-button @click="SubmitOrderType()">是</u-button>
        <u-button @click="isPopupShowSubmit = false">否</u-button>
      </view>
    </u-popup>

    <!-- 确定打卡店面信息 -->
    <u-popup
      v-model="isPopupshopVis"
      mode="center"
      border-radius="10"
      width="90%"
      @close="isPopupshopVis = false"
      class="popBox"
    >
      <view class="shop-submit-title">请确认店面信息是否准确</view>
      <view class="shop-submit-info">
        <view class="label">店面名称：</view>
        <view class="name">{{ storeName }}</view>
      </view>
      <view class="shop-submit-info">
        <view class="label">店面类型：</view>
        <view class="name">{{ storeType }}</view>
      </view>
      <view class="submit-btn">
        <view class="calcel" @click="selectShopTypeCan()">否</view>
        <view class="submit" @click="selectShopType()">是</view>
      </view>
    </u-popup>

    <!-- 选择店面类型 -->
    <u-popup
      v-model="selectShopTypePop"
      mode="center"
      border-radius="10"
      width="90%"
      @close="selectShopTypePop = false"
      class="popBox"
    >
      <view class="shop-submit-title">请确认店面信息是否准确</view>
      <view class="shop-submit-info">
        <view class="label">店面名称：</view>
        <view class="name">{{ storeName }}</view>
      </view>
      <view class="shop-submit-info">
        <view class="label">店面类型：</view>
        <view class="name">{{ storeType }}</view>
      </view>
      <view class="shop-submit-info">
        <view class="label" style="width: 230rpx"
          ><span style="color: red; padding-right: 4rpx">*</span
          >更正店面类型：</view
        >
        <view class="name" @click="selectStorePop">
          <view class="type-shop-value" v-if="selectStoreType">
            {{ selectStoreTypeLabel }}
            <u-icon
              v-if="selectStoreVis"
              name="arrow-up"
              color="#D8D8D8"
              size="28"
            ></u-icon>
            <u-icon v-else name="arrow-down" color="#D8D8D8" size="28"></u-icon>
          </view>
          <view class="type-shop-plce" v-else>
            请选择店面类型
            <u-icon
              v-if="selectStoreVis"
              name="arrow-up"
              color="#D8D8D8"
              size="28"
            ></u-icon>
            <u-icon v-else name="arrow-down" color="#D8D8D8" size="28"></u-icon>
          </view>
        </view>
      </view>
      <view class="shop-textarea-wrap">
        <u-input
          v-model="selectStoreTypeContent"
          type="textarea"
          class="shop-textarea"
          placeholder="备注"
          :border="false"
          :auto-height="true"
          maxlength="200"
        />
      </view>
      <view class="submit-btn">
        <view class="calcel" @click="editShopTypeCan()">取消</view>
        <view class="submit" @click="editShopTypeSub()">确认</view>
      </view>
    </u-popup>
    <!-- 修改店铺类型 -->
    <u-select
      v-model="selectStoreVis"
      :list="storeTypeList"
      @confirm="storeTypeConfirm"
    ></u-select>
    <!-- 选择预计完成日期 -->
    <u-calendar
      v-model="isCalendarShow"
      mode="date"
      @change="handleDateChange"
      :min-date="todayString"
			max-date="2050-12-31"
    ></u-calendar>
    <!-- toast -->
    <u-toast ref="uToast" z-index="99999999" />
  </view>
</template>

<script>
import {
  getCreateTaskForm,
  saveTaskExt,
  getTaskConfigList,
  getStoreTypes,
} from "../../common/service.js";
import utils from "../../common/utils.js";
import delSlideLeft from "@/components/ay-operate/del_slideLeft.vue";
const createQuestionTask = () => ({
  value: '',
})
const createTodoData = () => ({
  isGenerate: 'N',
  handler: '',
  handlerName: '',
  planCompletionTime: '',
})
export default {
  components: {
    delSlideLeft,
  },
  data() {
    return {
      storeId: "",
      storeName: "",
      custName: "",
      storeMode: "",
      storeType: "",
      fixedTasks: [],
      list: [
        {
          name: "是",
          code: 1,
          value: 'Y',
          disabled: false,
        },
        {
          name: "否",
          code: 0,
          value: 'N',
          disabled: false,
        },
      ],
      keyTaskList: [{ value: "" }],
      brandTaskList: [{ value: "" }],
      questionTaskList: [{ value: "" }],
      questionTodo: createTodoData(),
      taskConfigList: [],
      xdTaskDotr: "",
      isPopupShowSubmit: false,
      isPopupShowEmpty: false,
      showVideoUrl: "",
      videoContext: null,
      taskDynamicShow: false,
      flage: false,
      fixedWrapBtn: false,
      trainChilds: {
        pics: [],
        videos: [],
      },
      verificationSwitch: false, //必填项校验开关
      isPopupshopVis: false,
      selectShopTypePop: false,
      storeTypeList: [],
      selectStoreVis: false,
      selectStoreType: "",
      selectStoreTypeLabel: "",
      selectStoreTypeContent: "",
      isCalendarShow: false,
      todayString: this.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
			currentTask: null,
    };
  },
  onLoad: function (option) {
    console.log(option);
    this.storeId = option.id;
    this.move();
    this.LOGINACTION();
    // 初始化校验开关设置为开
    this.verificationSwitch = true;
    // 获取助店任务表单
    this.qureryGetCreateTaskForm(option.id);
    this.custName = this.CONFIG.user.name;
    // 获取店面类型
    this.getTypeList();
  },
  onShow: function () {
    const that = this;
  },
  onUnload() {
    // 页面销毁时取消网络请求
    this.stop();
  },
  computed: {
    isHasQuestion() {
      console.log('this.questionTaskList', this.questionTaskList)
      if (!this.questionTaskList || this.questionTaskList.length == 0) {
        return false;
      }
      return this.questionTaskList.filter(q => q.value).length > 0;
    }
  },
  methods: {
    // 阻止页面滚动
    stop() {
      var box = function (e) {
        passive: false;
      };
      document.body.style.overflow = "hidden";
      document.addEventListener("touchmove", box, false);
    },
    // 允许页面滚动
    move() {
      var box = function (e) {
        passive: false;
      };
      document.body.style.overflow = ""; // 出现滚动条
      document.removeEventListener("touchmove", box, false);
    },

    // 获取焦点
    handleFocus() {
      this.fixedWrapBtn = true;
    },

    // 市区焦点
    handleBlur() {
      this.fixedWrapBtn = false;
    },

    // 模块折叠/展开功能
    sampleManagFoldFun(index) {
      const that = this;
      that.fixedTasks[index].father.sampleFoldExpand =
        !that.fixedTasks[index].father.sampleFoldExpand;
    },

    // 助店任务
    taskDynamicShowFun() {
      const that = this;
      that.taskDynamicShow = !that.taskDynamicShow;
    },
    // 计算是否需要数量提交
    computeIsHasQuantity(items, item) {
	  if(item.father.dictValue == "XD_TASK_XPGL"){
		return (item.childs[0].isEnable == 0 && item.childs[0].dictValue == 'XD_TASK_XPGL_0')
	  }
      return (
        (items.isEnable == 1 &&
          items.dictValue != "XD_TASK_XIXX_0" &&
          items.dictValue != "XD_TASK_XIXX_1" &&
          items.dictValue != "XD_TASK_XIXX_2") ||
        item.father.dictValue == "XD_TASK_BRAND" ||
        (items.isEnable == 0 && items.dictValue == "XD_TASK_XIXX_0") ||
        (items.isEnable == 0 && items.dictValue == "XD_TASK_XIXX_2") ||
        (items.isEnable == 0 && items.dictValue == "XD_TASK_XIXX_1")		
      );
    },
    // 获取助店任务表单
    qureryGetCreateTaskForm(id) {
      const that = this;
      const list = [];
      const params = {
        id,
      };
      getCreateTaskForm(
        params,
        function (resuser) {
          if (resuser && resuser.statusCode == 200) {
            const rs = resuser.data;
            if (rs.code == 200) {
              const list = rs.data || [];

              that.storeName = list.storeName;
              that.storeMode = list.storeMode;
              that.storeType = list.storeType;
              // 固定模块
              list.fixedTasks.map((item, index) => {
                list.fixedTasks[index].father.sampleFoldExpand = true;
                if (
                  item.father.dictValue == "XD_TASK_YPGL" ||
                  item.father.dictValue == "XD_TASK_XPGL" ||
                  item.father.dictValue == "XD_TASK_CPEWM" ||
                  item.father.dictValue == "XD_TASK_CPBQ"
                ) {
                  item.childs.map((items, indexs) => {
                    list.fixedTasks[index].childs[indexs].planCompletionTime = null;
                    list.fixedTasks[index].childs[indexs].pics = [];
                    list.fixedTasks[index].childs[indexs].videos = [];
                    list.fixedTasks[index].childs[indexs].videos = [];
                    list.fixedTasks[index].childs[indexs].isEnable = 3;
                  });
                }
                if (item.father.dictValue == "XD_TASK_XTXX") {
                  item.childs.map((items, indexs) => {
                    list.fixedTasks[index].childs[indexs].isEnable = 1;
                  });
                }
                // 品牌部重点工作安排及其他  ---  合同签置
                if (item.father.dictValue == "XD_TASK_BRAND") {
                  item.childs.map((items, indexs) => {
                    if (items.dictValue == "XD_TASK_BRAND_3") {
                      list.fixedTasks[index].childs[indexs].files = [];
                    }
                  });
                }

                item.childs.map((items, indexs) => {
                  list.fixedTasks[index].childs[indexs].remark = [];
                });
              });
              that.fixedTasks = list.fixedTasks;
              // 直营动态模块
              if (list.storeMode == "0") {
                if (list.dynamicTasks && list.dynamicTasks.length > 0) {
                  that.taskConfigList = list.dynamicTasks.map(l => ({
                    ...l,
                    remark: [],
                    pics: [],
                    videos: [],
                    ...createTodoData(),
                  }));
                } else {
                  that.$refs.uToast.show({
                    title:
                      "该店面没有配置助店任务，请联系管理员配置助店打卡任务",
                    type: "error",
                    duration: 3000,
                    callback: function () {
                      uni.navigateTo({
                        url: `../toStore/index`,
                      });
                    },
                  });
                }
              } else {
                // 加盟店控制是否必填
                that.verificationSwitch = true;
              }
            } else {
              if (rs.msg) {
                that.$refs.uToast.show({
                  title: rs.msg || "获取表单失败",
                  type: "error",
                  duration: 3000,
                  callback: function () {
                    return;
                  },
                });
              }
            }
          } else {
            console.log("模拟数据");
          }
        },
        function (e) {}
      );
    },

    // 获取任务助店任务配置列表
    queryGetTaskConfigList() {
      const that = this;
      getTaskConfigList(
        {},
        function (resuser) {
          if (resuser && resuser.statusCode == 200) {
            const rs = resuser.data;
            if (rs.code == 200) {
              const list = rs.data || [];
              console.log("taskConfigList", list);
              that.taskConfigList = list.map(l => ({
                ...l,
                remark: [],
                pics: [],
                videos: [],
                ...createTodoData(),
              }));
            } else {
              if (rs.msg) {
                that.$refs.uToast.show({
                  title: rs.msg || "获取失败",
                  type: "error",
                  duration: 3000,
                  callback: function () {
                    return;
                  },
                });
              }
            }
          } else {
            console.log("模拟数据");
          }
        },
        function (e) {}
      );
    },

    // 获取店面类型
    getTypeList() {
      const that = this;
      getStoreTypes(
        {},
        function (resuser) {
          if (resuser && resuser.statusCode == 200) {
            const rs = resuser.data;
            if (rs.code == 200) {
              const list = rs.data || [];
              list.map((item) => {
                that.storeTypeList.push({
                  value: item.storeTypeCode,
                  label: item.storeType,
                });
              });
            } else {
              if (rs.msg) {
                that.$refs.uToast.show({
                  title: rs.msg || "获取失败",
                  type: "error",
                  duration: 3000,
                  callback: function () {
                    return;
                  },
                });
              }
            }
          } else {
            console.log("模拟数据");
          }
        },
        function (e) {}
      );
    },

    // 显示店面类型select
    selectStorePop() {
      this.selectStoreVis = true;
    },

    // 店面类型修改
    storeTypeConfirm(e) {
      console.log(e);
      this.selectStoreType = e[0].value;
      this.selectStoreTypeLabel = e[0].label;
      this.selectStoreVis = false;
    },

    // 选中某个单选框时，由radio时触发
    onChangeMarkChoose(e, item) {
      const that = this;
      const dictValue = item.dictValue;
      // 直营
      if (dictValue == "XD_TASK_DOTR") {
        that.fixedTasks.map((item, index) => {
          if (dictValue == item.father.dictValue) {
            that.fixedTasks[index].isEnable = e == "是" ? 1 : 0;
          }
        });
      } else {
        // 加盟
        that.fixedTasks.map((item, index) => {
          item.childs.map((items, indexs) => {
            if (dictValue == items.dictValue) {
              that.fixedTasks[index].childs[indexs].isEnable =
                e == "是" ? 1 : 0;
            }
          });
        });
      }
    },

    // 选中任一radio时，由radio-group触发
    radioGroupChange(e) {
      console.log(e);
    },

    // 数量
    byNumberChange(e) {
      console.log(e);
    },
    // 直营是否生成待办
    onDirectTodoChange(e, item) {
      if (e === "N") {
        item.planCompletionTime = undefined;
        item.handler = undefined;
        item.handlerName = undefined;
      }
    },
    // 选择人员名单
    selectEnterpriseContact(item) {
      let that = this
      this.INITWXJSDK(this.CONFIG.appid, location.origin + location.pathname + location.search, function() {
        that.$wx.invoke("selectEnterpriseContact", {
          "fromDepartmentId": -1, // 必填，-1表示打开的通讯录从自己所在部门开始展示, 0表示从最上层开始
          "mode": "single", // 必填，选择模式，single表示单选，multi表示多选
          "type": ["user"], // 必填，选择限制类型，指定department、user中的一个或者多个
          "selectedDepartmentIds": [], // 非必填，已选部门ID列表
          "selectedUserIds": [] // 非必填，已选用户ID列表
        }, function(res) {
          if (res.err_msg == "selectEnterpriseContact:ok") {
						item.handler = res.result.userList[0].id;
						item.handlerName = res.result.userList[0].name;
          }
        });
      })
    },
		handleCompletionTimeClick(item) {
			this.currentTask = item;
			this.isCalendarShow = true;
		},
    // 预计完成时间
    handleDateChange(e) {
			const { currentTask } = this;
			if (currentTask) {
				currentTask.planCompletionTime = e.result;
			}
			this.currentTask = null;
    },
    // 动态模块图片预览
    imgPreConfigView(id, idx) {
      const that = this;
      const list = [];

      that.taskConfigList.map((item, index) => {
        console.log(id, item.configId);
        if (id == item.configId) {
          that.taskConfigList[index].pics.forEach(function (item) {
            list.push(item.url);
          });
        }
      });
      // 预览图片
      uni.previewImage({
        current: idx, // uni有一个自带的previewImage方法，是预览图片的效果，但current属性在h5下传入Number不兼容，所以使用数组的方式传入。
        urls: list,
      });
    },

    // 固定模块图片预览
    imgPreview(dictValue, idx) {
      const that = this;
      console.log("预览图片:", dictValue, idx);
      const list = [];
      if (dictValue == "trainChildsImg") {
        // 是否培训
        that.trainChilds.pics.forEach(function (item) {
          list.push(item.url);
        });
      } else {
        that.fixedTasks.map((item, index) => {
          item.childs.map((items, indexs) => {
            if (dictValue == items.dictValue) {
              that.fixedTasks[index].childs[indexs].pics.forEach(function (
                item
              ) {
                list.push(item.url);
              });
            }
          });
        });
      }
      // 预览图片
      uni.previewImage({
        current: idx, // uni有一个自带的previewImage方法，是预览图片的效果，但current属性在h5下传入Number不兼容，所以使用数组的方式传入。
        urls: list,
      });
    },

    // 附件预览里面的预览图片
    imgPreFileImgs(dictValue, imgUrl) {
      const that = this;
      console.log("预览图片:", dictValue, imgUrl);
      const list = [];
      const idx = 0;
      that.fixedTasks.map((item, index) => {
        item.childs.map((items, indexs) => {
          if (dictValue == items.dictValue) {
            that.fixedTasks[index].childs[indexs].files.forEach(function (
              item
            ) {
              // 过滤店pdf文件
              !item.url.includes(".pdf") && list.push(item.url);
            });
          }
        });
      });
      console.log("预览结果", list);
      list.map((item, index) => {
        if (item == imgUrl) {
          // 预览图片
          uni.previewImage({
            current: index,
            urls: list,
          });
        }
      });
    },

    // 附件预览
    imgPreFiles(url) {
      const item = {
        type: "2",
        name: "预览文档",
        src: url,
      };

      uni.navigateTo({
        url:
          "/pages/openPDF/index?item=" +
          encodeURIComponent(JSON.stringify(item)),
      });
    },

    //微信小程序预览文档,可预览.doc,.docx,.xls,.xlsx,.pdf等文件
    previewWechat(urlPdf) {
      uni.showLoading({
        title: "正在加载中..",
      });
      uni.downloadFile({
        url: urlPdf,
        success: function (res) {
          var filePath = res.tempFilePath;
          uni.openDocument({
            filePath: filePath,
            showMenu: true,
            success: function (res) {
              console.log("打开文档成功");
              uni.hideLoading();
            },
          });
        },
        complete: function (r) {
          uni.hideLoading();
        },
      });
    },

    // 视频放大播放
    showVideoFn(url) {
      console.log(url);
      const that = this;
      this.showVideoUrl = url;
      setTimeout(function () {
        // 获取 video 上下文 videoContext 对象
        that.videoContext = uni.createVideoContext("myVideo");
        console.log("获取到视频对象:");
        console.log(that.videoContext);
        // 进入全屏状态
        that.videoContext.requestFullScreen();
        // 播放
        that.videoContext.play();
      }, 40);
    },

    // 关闭视频放大
    closeVideoFn() {
      this.videoContext.exitFullScreen();
      this.showVideoUrl = "";
    },

    // 删除图片 固定模块
    deleteFileFn(dictValue, idx, type) {
      const that = this;
      // deleteFile
      console.log("dictValue--", dictValue, "index--", idx);
      if (dictValue == "trainChildsImg") {
        // 是否培训
        if (type == "pics") {
          that.trainChilds.pics.splice(idx, 1);
        } else if (type == "videos") {
          that.trainChilds.videos.splice(idx, 1);
        }
      } else {
        // 其他
        that.fixedTasks.map((item, index) => {
          item.childs.map((items, indexs) => {
            if (dictValue == items.dictValue) {
              if (type == "pics") {
                that.fixedTasks[index].childs[indexs].pics.splice(idx, 1);
              } else if (type == "videos") {
                that.fixedTasks[index].childs[indexs].videos.splice(idx, 1);
              } else if (type == "file") {
                that.fixedTasks[index].childs[indexs].files.splice(idx, 1);
              }
            }
          });
        });
      }
    },

    // 删除图片 动态
    deleteFileConfigFn(id, idx, type) {
      const that = this;
      console.log(id, idx, type);
      that.taskConfigList.map((item, index) => {
        console.log(id, item.configId);
        if (id == item.configId) {
          if (type == "pics") {
            that.taskConfigList[index].pics.splice(idx, 1);
          } else if (type == "videos") {
            that.taskConfigList[index].videos.splice(idx, 1);
          }
        }
      });
    },

    // 助店任务  图片上传  动态
    uploadImgConfigFn(id) {
      console.log("uploadImgConfigFn--", id);
      const that = this;
      uni.chooseImage({
        count: 1,
        success: (chooseImageRes) => {
          console.log("chooseImage", chooseImageRes);
          const tempFilePaths = chooseImageRes.tempFilePaths;
          const tempFiles = chooseImageRes.tempFiles;
          var filePath = tempFilePaths[0] || "";
          var imgFile = tempFiles[0] || null;
          if (imgFile) {
            console.log(imgFile);
            var buName = "xdImg"; // 自定义上传接口路径
            var fileType = imgFile.type; // 文件类型
            var params = {
              // sourcessType: '巡店图片', // 业务类型、记录分类
              createBy: that.CONFIG.user.id, // 创建者(华耐工号)
              fileType: fileType, // 文件类型
              isActive: "是", // 是否有效
            };
            uni.showLoading({
              title: "上传中",
              mask: true,
            });
            that.showULineProgress = true;
            const uploadTask = uni.uploadFile({
              url: that.CONFIG.api + "/common/upload/" + buName,
              file: imgFile,
              filePath: filePath,
              name: "file",
              header: {
                Authorization: "Bearer " + (that.CONFIG.token || ""),
                lesseeid: that.CONFIG.lesseeid || "",
              },
              formData: params,
              success: (uploadFileRes) => {
                console.log("上传停止:", uploadFileRes);
                uni.hideLoading();
                that.showULineProgress = false;
                that.currentProgress = 0;
                if (uploadFileRes.statusCode == 200) {
                  let data = uploadFileRes.data;
                  console.log(data);
                  if (data && typeof data == "string") {
                    data = JSON.parse(data);
                    console.log(data);
                  }
                  if (data.fileId && data.code == 200) {
                    const obj = {
                      fileId: data.fileId, // 文件记录id，编辑更新、删除时要传，新增时不传
                      fileName: data.fileName,
                      url: data.url,
                    };
                    that.taskConfigList.map((item, index) => {
                      console.log(id, item.configId);
                      if (id == item.configId) {
                        that.taskConfigList[index].pics.push(obj);
                      }
                    });
                    console.log(that.taskConfigList);
                  } else {
                    console.log("上传失败-----：");
                    console.log(data.msg);
                    that.$refs.uToast.show({
                      title: data.msg || "上传失败",
                      type: "error", // primary / success / error / warning / info
                      duration: 8000,
                    });
                  }
                }
              },
            });
            uploadTask.onProgressUpdate((res) => {
              that.currentProgress = res.progress;
              console.log("上传进度" + res.progress);
              console.log("已经上传的数据长度" + res.totalBytesSent);
              console.log(
                "预期需要上传的数据总长度" + res.totalBytesExpectedToSend
              );
            });
          }
        },
      });
    },

    // 助店任务  视频上传  动态
    uploadVideoConfigFn(id) {
      console.log("dictValue--", id);
      const that = this;
      uni.chooseVideo({
        sourceType: ["album"],
        success: function (chooseImageRes) {
          var tempFilePaths = chooseImageRes.tempFilePath || ""; // 选定视频的临时文件路径
          const tempFiles = chooseImageRes.tempFile;
          console.log("chooseImageResVid", chooseImageRes);
          var filePath = tempFilePaths[0] || "";
          var imgFile = tempFiles || null;
          if (imgFile) {
            console.log(imgFile);
            var buName = "xdImg"; // 自定义上传接口路径
            var fileType = imgFile.type; // 文件类型
            var params = {
              // sourcessType: '巡店图片', // 业务类型、记录分类
              createBy: that.CONFIG.user.id, // 创建者(华耐工号)
              fileType: fileType, // 文件类型
              isActive: "是", // 是否有效
            };
            uni.showLoading({
              title: "上传中",
              mask: true,
            });
            that.showULineProgress = true;
            const uploadTask = uni.uploadFile({
              url: that.CONFIG.api + "/common/upload/" + buName,
              file: imgFile,
              filePath: filePath,
              name: "file",
              header: {
                Authorization: "Bearer " + (that.CONFIG.token || ""),
                lesseeid: that.CONFIG.lesseeid || "",
              },
              formData: params,
              success: (uploadFileRes) => {
                console.log("上传停止:", uploadFileRes);
                uni.hideLoading();
                that.showULineProgress = false;
                that.currentProgress = 0;
                if (uploadFileRes.statusCode == 200) {
                  let data = uploadFileRes.data;
                  console.log(data);
                  if (data && typeof data == "string") {
                    data = JSON.parse(data);
                    console.log(data);
                  }
                  if (data.fileId && data.code == 200) {
                    const obj = {
                      fileId: data.fileId, // 文件记录id，编辑更新、删除时要传，新增时不传
                      fileName: data.fileName,
                      url: data.url,
                    };
                    that.taskConfigList.map((item, index) => {
                      if (id == item.configId) {
                        that.taskConfigList[index].videos.push(obj);
                      }
                    });
                    console.log(that.taskConfigList);
                  } else {
                    console.log("上传失败-----：");
                    console.log(data.msg);
                    that.$refs.uToast.show({
                      title: data.msg || "上传失败",
                      type: "error", // primary / success / error / warning / info
                      duration: 8000,
                    });
                  }
                }
              },
            });
            uploadTask.onProgressUpdate((res) => {
              that.currentProgress = res.progress;
              console.log("上传进度" + res.progress);
              console.log("已经上传的数据长度" + res.totalBytesSent);
              console.log(
                "预期需要上传的数据总长度" + res.totalBytesExpectedToSend
              );
            });
          }
        },
      });
    },

    // 上传图片
    uploadImgFn(dictValue) {
      console.log("dictValue--", dictValue);
      const that = this;
      uni.chooseImage({
        count: 1,
        success: (chooseImageRes) => {
          console.log("chooseImage", chooseImageRes);
          const tempFilePaths = chooseImageRes.tempFilePaths;
          const tempFiles = chooseImageRes.tempFiles;
          var filePath = tempFilePaths[0] || "";
          var imgFile = tempFiles[0] || null;
          if (imgFile) {
            console.log(imgFile);
            var buName = "xdImg"; // 自定义上传接口路径
            var fileType = imgFile.type; // 文件类型
            var params = {
              // sourcessType: '巡店图片', // 业务类型、记录分类
              createBy: that.CONFIG.user.id, // 创建者(华耐工号)
              fileType: fileType, // 文件类型
              isActive: "是", // 是否有效
            };
            uni.showLoading({
              title: "上传中",
              mask: true,
            });
            that.showULineProgress = true;
            const uploadTask = uni.uploadFile({
              url: that.CONFIG.api + "/common/upload/" + buName,
              file: imgFile,
              filePath: filePath,
              name: "file",
              header: {
                Authorization: "Bearer " + (that.CONFIG.token || ""),
                lesseeid: that.CONFIG.lesseeid || "",
              },
              formData: params,
              success: (uploadFileRes) => {
                console.log("上传停止:", uploadFileRes);
                uni.hideLoading();
                that.showULineProgress = false;
                that.currentProgress = 0;
                if (uploadFileRes.statusCode == 200) {
                  let data = uploadFileRes.data;
                  console.log(data);
                  if (data && typeof data == "string") {
                    data = JSON.parse(data);
                    console.log(data);
                  }
                  if (data.fileId && data.code == 200) {
                    const obj = {
                      fileId: data.fileId, // 文件记录id，编辑更新、删除时要传，新增时不传
                      fileName: data.fileName,
                      url: data.url,
                    };
                    if (dictValue == "trainChildsImg") {
                      // 是否培训
                      that.trainChilds.pics.push(obj);
                    } else {
                      that.fixedTasks.map((item, index) => {
                        item.childs.map((items, indexs) => {
                          if (dictValue == items.dictValue) {
                            that.fixedTasks[index].childs[indexs].pics.push(
                              obj
                            );
                          }
                        });
                      });
                      console.log(that.fixedTasks);
                    }
                  } else {
                    console.log("上传失败-----：");
                    console.log(data.msg);
                    that.$refs.uToast.show({
                      title: data.msg || "上传失败",
                      type: "error", // primary / success / error / warning / info
                      duration: 8000,
                    });
                  }
                }
              },
            });
            uploadTask.onProgressUpdate((res) => {
              that.currentProgress = res.progress;
              console.log("上传进度" + res.progress);
              console.log("已经上传的数据长度" + res.totalBytesSent);
              console.log(
                "预期需要上传的数据总长度" + res.totalBytesExpectedToSend
              );
            });
          }
        },
      });
    },

    // 上传视频
    uploadVideoFn(dictValue) {
      console.log("dictValue--", dictValue);
      const that = this;
      uni.chooseVideo({
        sourceType: ["album"],
        success: function (chooseImageRes) {
          var tempFilePaths = chooseImageRes.tempFilePath || ""; // 选定视频的临时文件路径
          const tempFiles = chooseImageRes.tempFile;
          console.log("chooseImageResVid", chooseImageRes);
          var filePath = tempFilePaths[0] || "";
          var imgFile = tempFiles || null;
          if (imgFile) {
            console.log(imgFile);
            var buName = "xdImg"; // 自定义上传接口路径
            var fileType = imgFile.type; // 文件类型
            var params = {
              // sourcessType: '巡店图片', // 业务类型、记录分类
              createBy: that.CONFIG.user.id, // 创建者(华耐工号)
              fileType: fileType, // 文件类型
              isActive: "是", // 是否有效
            };
            uni.showLoading({
              title: "上传中",
              mask: true,
            });
            that.showULineProgress = true;
            const uploadTask = uni.uploadFile({
              url: that.CONFIG.api + "/common/upload/" + buName,
              file: imgFile,
              filePath: filePath,
              name: "file",
              header: {
                Authorization: "Bearer " + (that.CONFIG.token || ""),
                lesseeid: that.CONFIG.lesseeid || "",
              },
              formData: params,
              success: (uploadFileRes) => {
                console.log("上传停止:", uploadFileRes);
                uni.hideLoading();
                that.showULineProgress = false;
                that.currentProgress = 0;
                if (uploadFileRes.statusCode == 200) {
                  let data = uploadFileRes.data;
                  console.log(data);
                  if (data && typeof data == "string") {
                    data = JSON.parse(data);
                    console.log(data);
                  }
                  if (data.fileId && data.code == 200) {
                    const obj = {
                      fileId: data.fileId, // 文件记录id，编辑更新、删除时要传，新增时不传
                      fileName: data.fileName,
                      url: data.url,
                    };
                    if (dictValue == "trainChildsVideo") {
                      // 是否培训
                      that.trainChilds.videos.push(obj);
                    } else {
                      that.fixedTasks.map((item, index) => {
                        item.childs.map((items, indexs) => {
                          if (dictValue == items.dictValue) {
                            that.fixedTasks[index].childs[indexs].videos.push(
                              obj
                            );
                          }
                        });
                      });
                      console.log(that.fixedTasks);
                    }
                  } else {
                    console.log("上传失败-----：");
                    console.log(data.msg);
                    that.$refs.uToast.show({
                      title: data.msg || "上传失败",
                      type: "error", // primary / success / error / warning / info
                      duration: 8000,
                    });
                  }
                }
              },
            });
            uploadTask.onProgressUpdate((res) => {
              that.currentProgress = res.progress;
              console.log("上传进度" + res.progress);
              console.log("已经上传的数据长度" + res.totalBytesSent);
              console.log(
                "预期需要上传的数据总长度" + res.totalBytesExpectedToSend
              );
            });
          }
        },
      });
    },

    // 上传附件
    uploadFileFn(dictValue) {
      console.log("dictValue--", dictValue);
      const that = this;
      uni.chooseFile({
        count: 1, // 默认选择一个文件
        type: "file", // 选择文件
        extension: ["jpg", "jpeg", "png", "pdf"], // 限制文件扩展名
        success: (chooseImageRes) => {
          const tempFilePaths = chooseImageRes.tempFilePaths;
          const tempFiles = chooseImageRes.tempFiles;
          var filePath = tempFilePaths[0] || "";
          var imgFile = tempFiles[0] || null;
          if (imgFile) {
            console.log(imgFile);
            var buName = "xdImg"; // 自定义上传接口路径
            var fileType = imgFile.type; // 文件类型
            var params = {
              // sourcessType: '巡店图片', // 业务类型、记录分类
              createBy: that.CONFIG.user.id, // 创建者(华耐工号)
              fileType: fileType, // 文件类型
              isActive: "是", // 是否有效
            };
            uni.showLoading({
              title: "上传中",
              mask: true,
            });
            that.showULineProgress = true;
            const uploadTask = uni.uploadFile({
              url: that.CONFIG.api + "/common/upload/" + buName,
              file: imgFile,
              filePath: filePath,
              name: "file",
              header: {
                Authorization: "Bearer " + (that.CONFIG.token || ""),
                lesseeid: that.CONFIG.lesseeid || "",
              },
              formData: params,
              success: (uploadFileRes) => {
                console.log("上传停止:", uploadFileRes);
                uni.hideLoading();
                that.showULineProgress = false;
                that.currentProgress = 0;
                if (uploadFileRes.statusCode == 200) {
                  let data = uploadFileRes.data;
                  console.log(data);
                  if (data && typeof data == "string") {
                    data = JSON.parse(data);
                    console.log(data);
                  }
                  if (data.fileId && data.code == 200) {
                    const obj = {
                      fileId: data.fileId, // 文件记录id，编辑更新、删除时要传，新增时不传
                      fileName: data.fileName,
                      url: data.url,
                    };
                    that.fixedTasks.map((item, index) => {
                      item.childs.map((items, indexs) => {
                        if (dictValue == items.dictValue) {
                          that.fixedTasks[index].childs[indexs].files.push(obj);
                        }
                      });
                    });
                    console.log("ASAS", that.fixedTasks);
                  } else {
                    console.log("上传失败-----：");
                    console.log(data.msg);
                    that.$refs.uToast.show({
                      title: data.msg || "上传失败",
                      type: "error", // primary / success / error / warning / info
                      duration: 8000,
                    });
                  }
                }
              },
            });
            uploadTask.onProgressUpdate((res) => {
              that.currentProgress = res.progress;
              console.log("上传进度" + res.progress);
              console.log("已经上传的数据长度" + res.totalBytesSent);
              console.log(
                "预期需要上传的数据总长度" + res.totalBytesExpectedToSend
              );
            });
          }
        },
      });
    },

    // 新增文本框
    addActivity(type) {
      switch (type) {
        case "XD_TASK_XIXX_1":
          this.keyTaskList.push({ value: "" });
          break;
        case "XD_TASK_BRAND_0":
          this.brandTaskList.push({ value: "" });
          break;
        case "XD_TASK_QUESTION":
          this.questionTaskList.push(createQuestionTask());
          break;
        default:
          console.log("");
      }
    },

    // 删除文本框
    removeActivity(type, index) {
      switch (type) {
        case "XD_TASK_XIXX_1":
          this.keyTaskList.splice(index, 1);
          break;
        case "XD_TASK_BRAND_0":
          this.brandTaskList.splice(index, 1);
          break;
        case "XD_TASK_QUESTION":
          this.questionTaskList.splice(index, 1);
          break;
        default:
          console.log("");
      }
    },

    //数组校验
    isEmptyArray(arr) {
      return Array.isArray(arr) && arr.length === 1 && arr[0] === "";
    },

    // 取消按钮
    cancelOrder() {
      this.isPopupShowEmpty = true;
    },

    // 取消弹框的  是
    emptyConfirm() {
      uni.navigateTo({
        url: "../toStore/index",
      });
    },

    // 确认按钮
    SubmitConfirm() {
      this.isPopupShowSubmit = true;
    },

    // 修改店面信息 取消
    editShopTypeCan() {
      this.selectShopTypePop = false;
    },

    // 更正店面类型 是
    selectShopType() {
      this.isPopupshopVis = false;
      this.SubmitOrder();
    },

    // 更正店面类型 否
    selectShopTypeCan() {
      this.isPopupshopVis = false;
      this.selectShopTypePop = true;
    },

    // 修改店面信息 确定
    editShopTypeSub() {
      if (!this.selectStoreType) {
        this.$refs.uToast.show({
          title: "请选择店面类型",
          type: "error",
          duration: 3000,
          callback: function () {
            return;
          },
        });
        return;
      } else {
        this.selectShopTypePop = false;
        this.isPopupShowSubmit = false;
        this.SubmitOrder();
      }
    },

    // 确认弹框 是
    SubmitOrderType() {
      // 直营
      if (this.storeMode == "0") {
        this.SubmitOrder();
      } else {
        // 先判断打卡情况，在判断门店正确
        let r = this.SubmitOrderBefore();
        if ("ok" === r) {
          // 联盟
          this.isPopupshopVis = true;
        }
      }
    },
    SubmitOrderBefore() {
      const that = this;
      // 关闭提示弹框
      this.isPopupShowSubmit = false;

      const remarkList2 = [];
      that.brandTaskList.map((item, index) => {
        remarkList2.push(item.value);
      });

      // 处理 XD_TASK_QUESTION 逻辑 已解决/待解决问题反馈
      const remarkList3 = [];
      that.questionTaskList.map((item, index) => {
        remarkList3.push(item.value);
      });

      const submitLIst = [];

      if (that.storeMode == 1) {
        const xtxxChilds = ['XD_TASK_XIXX_0', 'XD_TASK_XIXX_1', 'XD_TASK_XIXX_2']
        for (let i = 0; i < that.fixedTasks.length; i++) {
          for (let j = 0; j < that.fixedTasks[i].childs.length; j++) {
            // 品牌部重点工作安排及其他 不用是否按钮校验 && that.verificationSwitch
            const currentChild = that.fixedTasks[i].childs[j];
            if (that.fixedTasks[i].father.dictValue != "XD_TASK_BRAND") {	
              // 按钮选择是
              if ((currentChild.isEnable == 1 && !xtxxChilds.includes(currentChild.dictValue) && 
			  that.fixedTasks[i].father.dictValue != 'XD_TASK_XPGL') ||
			   (currentChild.isEnable == 0 && that.fixedTasks[i].father.dictValue == 'XD_TASK_XPGL') ) {
                // 按钮选择是，校验备注
                if (
                  currentChild.remark.toString().length == 0 ||
                  currentChild.quantity == undefined ||
                  !currentChild.planCompletionTime
                ) {
                  console.log("按钮：是---备注：空 数量 0");
                  that.$refs.uToast.show({
                    title: "任务必填项请填写完整",
                    type: "error",
                    duration: 3000,
                    callback: function () {
                      return;
                    },
                  });
                  return;
                } else {
                  console.log("按钮：是---备注：有内容");
                }
              } else if (currentChild.isEnable == 0) {
                if (xtxxChilds.includes(currentChild.dictValue)) {
                  // 企业微信人员账号齐全性 人员异动信息更新及时性 选择否 校验备注
                  if (
                    !currentChild.remark ||
                    currentChild.remark.toString().length == 0 ||
										!currentChild.planCompletionTime
                  ) {
                    console.log("按钮：是---备注：空");
                    that.$refs.uToast.show({
                      title: "任务必填项请填写完整",
                      type: "error",
                      duration: 3000,
                      callback: function () {
                        return;
                      },
                    });
                    return;
                  } else {
                    console.log("按钮：是---备注：有内容");
                  }
                } else {
                  console.log("其他按钮 否 无需校验");
                }
              } else if (currentChild.isEnable == undefined) {
                // 是否按钮未选择
                console.log("是否按钮未选择");
                that.$refs.uToast.show({
                  title: "任务必填项请填写完整",
                  type: "error",
                  duration: 3000,
                  callback: function () {
                    return;
                  },
                });
                return;
              }
            }

            // 组装数据
            const assginItem = {
              childCode: currentChild.dictValue,
              fatherCode: that.fixedTasks[i].father.dictValue,
              isEnable:
                currentChild.isEnable == 3
                  ? 0
                  : currentChild.isEnable,
              quantity: currentChild.quantity
                ? currentChild.quantity
                : 0,
              remark:
                currentChild.dictValue == "XD_TASK_BRAND_0"
                  ? remarkList2
                  : currentChild.dictValue == "XD_TASK_QUESTION"
                  ? remarkList3
                  : typeof currentChild.remark == "string"
                  ? currentChild.remark.split()
                  : currentChild.remark,
            };
            const newItem = Object.assign(
              currentChild,
              assginItem
            );
            submitLIst.push(newItem);
          }
        }
      } else {
        // 动态配置
        for (let i = 0; i < that.taskConfigList.length; i++) {
          const currentTask = that.taskConfigList[i];
          if (
            currentTask.remark.toString().length == 0 &&
            that.verificationSwitch
          ) {
            that.$refs.uToast.show({
              title: "任务必填项请填写完整",
              type: "error",
              duration: 3000,
              callback: function () {
                return;
              },
            });
            return;
          } else {
            const assginItem = {
              configId: currentTask.configId,
              pics: currentTask.pics,
              videos: currentTask.videos,
              isEnable: currentTask.isEnable || 0,
              remark:
                typeof currentTask.remark == "string"
                  ? currentTask.remark.split()
                  : currentTask.remark,
            };
            submitLIst.push(assginItem);
          }
        }

        //  固定配置
        for (let j = 0; j < that.fixedTasks.length; j++) {
          // 组装数据
          const assginItem = {
            fatherCode: that.fixedTasks[j].father.dictValue,
          };
          if (
            that.fixedTasks[j].father.dictValue == "XD_TASK_DOTR" &&
            that.verificationSwitch
          ) {
            // 是否做培训
            console.log("是否做培训");
            if (that.fixedTasks[j].isEnableName == undefined) {
              that.$refs.uToast.show({
                title: "任务必填项请填写完整",
                type: "error",
                duration: 3000,
                callback: function () {
                  return;
                },
              });
              return;
            } else {
              console.log("按钮选择", that.fixedTasks[j].isEnableName);
              if (that.fixedTasks[j].isEnableName == "是") {
                console.log(
                  "--",
                  that.fixedTasks[j].isEnableName,
                  that.xdTaskDotr
                );
                if (that.xdTaskDotr.length == 0) {
                  that.$refs.uToast.show({
                    title: "任务必填项请填写完整",
                    type: "error",
                    duration: 3000,
                    callback: function () {
                      return;
                    },
                  });
                  return;
                } else {
                  assginItem.pics = that.trainChilds.pics || [];
                  assginItem.videos = that.trainChilds.videos || [];
                  assginItem.remark = that.xdTaskDotr
                    ? that.xdTaskDotr.split()
                    : [];
                }
              }
              assginItem.isEnable =
                that.fixedTasks[j].isEnableName == "是" ? 1 : 0;
            }
          } else if (
            that.fixedTasks[j].father.dictValue == "XD_TASK_QUESTION"
          ) {
            // 已解决/待解决问题反馈
            assginItem.remark = remarkList3;
          }
          submitLIst.push(assginItem);
        }
      }
      return "ok";
    },
    // 打卡
    SubmitOrder() {
      const that = this;
      // 关闭提示弹框
      this.isPopupShowSubmit = false;

      const remarkList2 = [];
      that.brandTaskList.map((item, index) => {
        remarkList2.push(item.value);
      });

      // 处理 XD_TASK_QUESTION 逻辑 已解决/待解决问题反馈
      const remarkList3 = [];
      that.questionTaskList.map((item, index) => {
        remarkList3.push(item.value);
      });

      const submitLIst = [];

      if (that.storeMode == 1) {
        const xtxxChilds = ['XD_TASK_XIXX_0', 'XD_TASK_XIXX_1', 'XD_TASK_XIXX_2']
        for (let i = 0; i < that.fixedTasks.length; i++) {
          for (let j = 0; j < that.fixedTasks[i].childs.length; j++) {
            // 品牌部重点工作安排及其他 不用是否按钮校验 && that.verificationSwitch
            const currentChild = that.fixedTasks[i].childs[j];
            if (that.fixedTasks[i].father.dictValue != "XD_TASK_BRAND") {
              // 按钮选择是
			  if ((currentChild.isEnable == 1 && !xtxxChilds.includes(currentChild.dictValue) && that.fixedTasks[i].father.dictValue != 'XD_TASK_XPGL') ||
			   (currentChild.isEnable == 0 && that.fixedTasks[i].father.dictValue == 'XD_TASK_XPGL') ) {
                // console.log('AA',that.fixedTasks[i].childs[j].remark.toString().length)
                // console.log('BB',that.fixedTasks[i].childs[j].quantity)
                // 按钮选择是，校验备注
                if (
                  currentChild.remark.toString().length == 0 ||
                  currentChild.quantity == undefined
                ) {
                  console.log("按钮：是---备注：空 数量 0");
                  that.$refs.uToast.show({
                    title: "任务必填项请填写完整",
                    type: "error",
                    duration: 3000,
                    callback: function () {
                      return;
                    },
                  });
                  return;
                } else {
                  console.log("按钮：是---备注：有内容");
                }
              } else if (currentChild.isEnable == 0) {
                if (xtxxChilds.includes(currentChild.dictValue)) {
                  // 企业微信人员账号齐全性 人员异动信息更新及时性 选择否 校验备注
                  if (
                    currentChild.remark &&
                    currentChild.remark.toString().length == 0
                  ) {
                    console.log("按钮：是---备注：空");
                    that.$refs.uToast.show({
                      title: "任务必填项请填写完整",
                      type: "error",
                      duration: 3000,
                      callback: function () {
                        return;
                      },
                    });
                    return;
                  } else {
                    console.log("按钮：是---备注：有内容");
                  }
                } else {
                  console.log("其他按钮 否 无需校验");
                }
              } else if (currentChild.isEnable == undefined) {
                // 是否按钮未选择
                console.log("是否按钮未选择");
                that.$refs.uToast.show({
                  title: "任务必填项请填写完整",
                  type: "error",
                  duration: 3000,
                  callback: function () {
                    return;
                  },
                });
                return;
              }
            }

            // 组装数据
            const assginItem = {
              childCode: currentChild.dictValue,
              fatherCode: that.fixedTasks[i].father.dictValue,
              isEnable:
                currentChild.isEnable == 3
                  ? 0
                  : currentChild.isEnable,
              quantity: currentChild.quantity
                ? currentChild.quantity
                : 0,
              remark:
                currentChild.dictValue == "XD_TASK_BRAND_0"
                  ? remarkList2
                  : currentChild.dictValue == "XD_TASK_QUESTION"
                  ? remarkList3
                  : typeof currentChild.remark == "string"
                  ? currentChild.remark.split()
                  : currentChild.remark,
            };
            const newItem = Object.assign(
              currentChild,
              assginItem
            );
            submitLIst.push(newItem);
          }
        }
      } else {
        // 动态配置
        // 校验数据动态必填项
        const errTask = that.taskConfigList.find((task) => {
          const { remark, isGenerate, handler, planCompletionTime } = task;
            // 如果备注没填 则提示
            if (remark.toString().length == 0 && that.verificationSwitch) return true;
            if (!isGenerate) return true;
            // 如果生成 且 未选择处理人 则提示
            if (isGenerate === 'Y' && (!handler || !planCompletionTime)) return true;
            return false;
        })
        const errFixedTask = that.fixedTasks.find((task) => {
          const { father: { dictValue }, isEnableName } = task;
          // 培训未填
          if (dictValue == "XD_TASK_DOTR") {
            return (that.verificationSwitch && isEnableName === undefined) || (isEnableName == "是" && that.xdTaskDotr.length == 0);
          }
          // 填了是 但培训内容没填
          if (dictValue === 'XD_TASK_QUESTION' && that.isHasQuestion) {
            const { isGenerate, handler, planCompletionTime } = that.questionTodo;
            return !isGenerate || (isGenerate === "Y" && (!handler || !planCompletionTime))
          }
          return false;
        })
        if (errTask || errFixedTask) {
          that.$refs.uToast.show({
            title: "任务必填项请填写完整",
            type: "error",
            duration: 3000,
          });
          return;
        }
        for (let i = 0; i < that.taskConfigList.length; i++) {
          const currentTask = that.taskConfigList[i];
         
          const assginItem = {
            configId: currentTask.configId,
            pics: currentTask.pics,
            videos: currentTask.videos,
            isEnable: currentTask.isEnable || 0,
            isGenerate: currentTask.isGenerate || "N",
            remark:
              typeof currentTask.remark == "string"
                ? currentTask.remark.split()
                : currentTask.remark,
          };
          if (currentTask.isGenerate === "Y") {
            assginItem.handler = currentTask.handler;
            assginItem.planCompletionTime = currentTask.planCompletionTime;
          }
          submitLIst.push(assginItem);
        }

        //  固定配置
        for (let j = 0; j < that.fixedTasks.length; j++) {
          // 组装数据
          const assginItem = {
            fatherCode: that.fixedTasks[j].father.dictValue,
          };
          if (
            that.fixedTasks[j].father.dictValue == "XD_TASK_DOTR" &&
            that.verificationSwitch
          ) {
            // 是否做培训
            console.log("是否做培训");
            if (that.fixedTasks[j].isEnableName == undefined) {
              return;
            } else {
              console.log("按钮选择", that.fixedTasks[j].isEnableName);
              if (that.fixedTasks[j].isEnableName == "是") {
                if (that.xdTaskDotr.length == 0) {
                  return;
                } else {
                  assginItem.pics = that.trainChilds.pics || [];
                  assginItem.videos = that.trainChilds.videos || [];
                  assginItem.remark = that.xdTaskDotr
                    ? that.xdTaskDotr.split()
                    : [];
                }
              }
              assginItem.isEnable =
                that.fixedTasks[j].isEnableName == "是" ? 1 : 0;
            }
          } else if (
            that.fixedTasks[j].father.dictValue == "XD_TASK_QUESTION"
          ) {
            // 已解决/待解决问题反馈
            assginItem.remark = remarkList3.filter(Boolean);
            const { isGenerate, handler, planCompletionTime } = that.questionTodo;
            if (isGenerate === "Y") {
              assginItem.isGenerate = 'Y';
              assginItem.handler = handler;
              assginItem.planCompletionTime = planCompletionTime;
            } else {
              assginItem.isGenerate = 'N';
            }
          }
          submitLIst.push(assginItem);
        }
      }

      const params = {
        storeId: that.storeId,
        storeMode: that.storeMode,
        storeType: that.storeType,
        custId: that.custId,
        details: submitLIst,
      };
      if (that.selectStoreType) {
        params.updateStoreType = that.selectStoreTypeLabel;
        params.updateRemark = that.selectStoreTypeContent;
      }
      console.log("params", params);
      console.log("saveTaskExt保存");
      // return
      saveTaskExt(
        params,
        (resuser) => {
          if (resuser && resuser.statusCode == 200) {
            const rs = resuser.data;
            if (rs.code == 200) {
              console.log(rs);
              that.$refs.uToast.show({
                title: "助店成功，一切轻松",
                type: "success",
                duration: 3000,
                callback: function () {
                  uni.navigateTo({
                    url: "../toStore/index",
                  });
                },
              });
            } else {
              that.$refs.uToast.show({
                title: rs.msg,
                type: "error",
                duration: 3000,
              });
            }
          }
        },
        (e) => {
          console.log("获取数据失败", e);
        }
      );
      // },300)
    },
  },
};
</script>

<style lang="scss" scoped>
.pages-toStoreDetail-index {
  // padding-bottom: 120rpx;
  background-color: #f3f5f7;
}

page {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  background-color: #f3f5f7;
}

.sotre-check {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  position: relative;
  background: #f3f5f7;
}

// .sotre-check div.basic-information:nth-last-child(1){
// 	padding-bottom: 120rpx;
// }
.basic-information {
  width: 710rpx;
  padding: 0 20rpx;
  background: #ffffff;
  border-radius: 10rpx;
  margin: 20rpx auto;
  overflow: hidden;

  .title {
    display: flex;
    justify-content: space-between;
    height: 82rpx;
    line-height: 82rpx;
    font-family: PingFangSC, PingFang SC;
    font-weight: 500;
    font-size: 30rpx;
    color: #333333;
    border-bottom: 1px solid #f7f7f7;
  }

  .border-style {
    height: auto !important;
    border-bottom: 1px solid #f7f7f7;
    padding: 26rpx 0;

    .store-name {
      line-height: 40rpx;
      // white-space:nowrap;
      // text-overflow:ellipsis;
      // overflow:hidden;
    }

    .label {
      color: #666666;
      min-width: 140rpx;
    }
  }

  .cust-name {
    .label {
      color: #666666;
    }
  }

  .cust-name-type {
    border-bottom: 1px solid #f7f7f7;

    .label {
      color: #666666;
    }
  }

  .title .fold {
    width: 82rpx;
    height: 82rpx;
    background: url("")
      no-repeat center right;
    background-size: 28rpx 16rpx;
    transform: rotate(-90deg);
    background-position: bottom;
    transform-origin: center;
  }

  .title .fold-active {
    transform: rotate(0);
    background-position: right;
    transform-origin: center;
  }

  .item {
    display: flex;
    align-items: center;
    height: 100rpx;
    line-height: 100rpx;
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    font-size: 28rpx;
    color: #333333;
  }

  .upload-item {
    margin-top: 15rpx;
    height: auto;
    align-items: flex-start;

    .label {
      padding-top: 20rpx;
    }
  }

  .remark-item {
    margin-top: 30rpx;
    margin-bottom: 30rpx;
  }

  .label {
    display: flex;
    font-size: 28rpx;
    color: #333;
    min-width: 100rpx;
    font-family: PingFangSC, PingFang SC;
  }

  .item-subtitle + .item-subtitle {
    border-top: 1px solid #f7f7f7;
  }
}

.xdtaskbrand {
  border-bottom: 1px solid #f7f7f7;

  .upload-item {
    margin-top: 0;
    margin-bottom: 30rpx;
  }
}

.sample-management-act {
  padding-bottom: 0;

  .title {
    border-bottom: none;
  }
}

.sample-management-dotr {
  padding-bottom: 30rpx;

  .title {
    border-bottom: none;
  }
}

.sample-style {
  padding-bottom: 90rpx;
}

.number-wrap {
}

#numberBox {
  width: 216rpx;
  height: 58rpx;
  border: 1px solid #bcbcbc;
  border-radius: 4rpx;

  /deep/ .u-icon-disabled {
    background: #ffffff !important;
    color: #cacaca !important;
  }

  /deep/ .u-icon-minus {
    color: #333333;
    height: 100% !important;
    border-right: 1px solid #bcbcbc;
  }

  /deep/ .u-icon-plus {
    color: #333333;
    height: 100% !important;
    border-left: 1px solid #bcbcbc;
  }
}

.upload-img-box {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;

  .files-wrap {
    position: relative;
    width: 173rpx;
    height: 173rpx;
    overflow: hidden;

    .click-wrap {
      position: absolute;
      left: 0;
      top: 0;
      right: 0;
      bottom: 0;
      z-index: 111;
    }
  }
}

.view-upload-item {
  position: relative;
  width: 173rpx;
  height: 173rpx;
  box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1);
  border-radius: 16rpx;
  margin-right: 15rpx;
  margin-top: 20rpx;
}

.my-video-bg {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 8;
}

.view-upload-item .cancel-btn {
  width: 30rpx;
  height: 30rpx;
  border-radius: 50%;
  position: absolute;
  top: -5rpx;
  right: -5rpx;
  z-index: 10;
}

.view-upload-item image,
.view-upload-item video {
  width: 100%;
  height: 100%;
  border-radius: 16rpx;
}

.view-upload-btn {
  width: 173rpx;
  height: 173rpx;
  background: #f7f7f7;
  border-radius: 16rpx;
  position: relative;
  margin-right: 15rpx;
  margin-top: 20rpx;
}

.view-upload-btn::before {
  content: " ";
  display: block;
  width: 60rpx;
  height: 3rpx;
  background: #d8d8d8;
  border-radius: 3rpx;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -1.5rpx;
  margin-left: -30rpx;
}

.view-upload-btn::after {
  content: " ";
  display: block;
  width: 3rpx;
  height: 60rpx;
  background: #d8d8d8;
  border-radius: 3rpx;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -30rpx;
  margin-left: -1.5rpx;
}

.my-form-textarea {
  height: 246rpx;
  width: 558rpx;
  background-color: #f7f7f7;
  border-radius: 16rpx;
  padding: 15rpx 30rpx !important;
  box-sizing: border-box;
  overflow-y: auto;
  // margin-top: 20rpx;
}
.custom-field {
  background: #f7f7f7;
  padding-left: 20rpx !important;
  padding-right: 20rpx !important;
  border-radius: 10rpx;
}
.problem-item {
  display: flex;
  width: 100%;
  height: 80rpx;
  // line-height: 80rpx;
  // background: #F7F7F7;
  overflow: hidden;

  .input-item {
    // width: calc(100% - 66px);
    // width: 100%;
    height: 80rpx;
    padding-left: 20rpx !important;
    padding-right: 20rpx;
    line-height: 80rpx;
  }

  .delete-item {
    width: 66rpx;
    height: 80rpx;
    background: url()
      no-repeat;
    background-size: 66rpx 88rpx;
  }
}

.problem-item + .problem-item {
  margin-top: 20rpx;
}

.add-problem {
  display: flex;
  align-items: center;
  height: 80rpx;
  font-family: PingFangSC, PingFang SC;
  font-weight: 400;
  font-size: 28rpx;
  color: #307dcd;
  justify-content: center;

  &-icon {
    width: 30rpx;
    height: 30rpx;
    margin-right: 11rpx;
    background: url("")
      no-repeat;
    background-size: contain;
    // border: 1px dotted rgb(138, 138, 138)
  }
}

.placeholder-view {
  width: 750rpx;
  height: 120rpx;
}

.operation-btn {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 750rpx;
  height: 120rpx;
  background: #ffffff;

  .cancel-oper {
    width: 330rpx;
    height: 90rpx;
    background: #f6f6f6;
    border-radius: 54rpx;
    font-family: PingFangSC, PingFang SC;
    font-weight: 600;
    font-size: 32rpx;
    color: #666666;
    text-align: center;
    line-height: 90rpx;
  }

  .confirm-oper {
    width: 330rpx;
    height: 90rpx;
    background: #307dcd;
    border-radius: 54rpx;
    font-family: PingFangSC, PingFang SC;
    font-weight: 600;
    font-size: 32rpx;
    color: #ffffff;
    text-align: center;
    line-height: 90rpx;
    margin-left: 30rpx;
  }
}

.task-content {
  padding-top: 30rpx;

  // padding-bottom: 30rpx;
  .title {
    width: 670rpx;
    height: auto;
    padding: 20rpx;
    line-height: 40rpx;
    background: #fafafa;
    font-family: PingFangSC, PingFang SC;
    font-weight: 500;
    font-size: 28rpx;
    color: #333333;
    border-radius: 10rpx;
  }
}

.show-video-box {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 500;
}

.show-video-box-bd {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* .show-video-box-bd video {
		width: 100%;
		height: 100%;
	} */

.close-show-video-btn {
  width: 88rpx;
  height: 88rpx;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 99999999999999;
  background: url("")
    no-repeat center;
  background-size: 48rpx;
}

.task-content + .task-content {
  padding-top: 40rpx;
  border-top: 1px solid #f7f7f7;
}

.basic-information .xdtaskbrand:last-child {
  border: none;
}

.item-subtitle {
  border-top: 1px solid #f7f7f7;
}

.basic-information .item-subtitle:first-child {
  border: none;
}

.popBox {
  /deep/.u-mode-center-box {
    padding: 30rpx 30rpx 10rpx;
  }

  /deep/.slot-content {
    padding-bottom: 20rpx;
  }

  /deep/.u-btn {
    margin-bottom: 20rpx;
  }
}

/deep/.u-radio__icon-wrap--checked {
  border: none !important;
  background: url("")
    no-repeat !important;
  background-size: cover !important;
}

/deep/.uicon-checkbox-mark:before {
  content: "";
}

/deep/.u-radio__label {
  color: #666;
}

// toast提示框样式修改
/deep/.u-toast {
  padding: 26rpx 30rpx;
}

/deep/.u-type-error {
  background: #fff7e6;
  border-radius: 10rpx;
  border: 1rpx solid #fa8c16;
}

/deep/.u-type-error .u-icon-wrap {
  width: 40rpx;
  height: 40rpx;
  background: url("../../static/toStore/tips1.png") no-repeat;
  background-size: contain;
}

/deep/.u-type-success .u-icon {
  display: none;
}

/deep/.u-type-error .u-icon {
  display: none;
}

/deep/.u-type-error .u-text {
  padding-left: 14rpx;
  font-family: PingFangSC, PingFang SC;
  font-weight: 400;
  font-size: 28rpx;
  color: #fa8c16;
}

/deep/.u-type-success {
  background: #f6ffed;
  border-radius: 10rpx;
  border: 1rpx solid #52c41a;
}

/deep/.u-type-success .u-icon-wrap {
  width: 40rpx;
  height: 40rpx;
  background: url("../../static/toStore/succ1.png") no-repeat;
  background-size: contain;
}

/deep/.u-type-success .u-text {
  padding-left: 14rpx;
  font-family: PingFangSC, PingFang SC;
  font-weight: 400;
  font-size: 28rpx;
  color: #52c41a;
}

.shop-submit-title {
  height: 135rpx;
  line-height: 135rpx;
  ont-weight: 600;
  font-size: 32rpx;
  color: #333333;
  text-align: center;
}

.shop-submit-info {
  display: flex;
  padding: 0 20rpx 20rpx;

  .label {
    width: 150rpx;
    font-size: 30rpx;
    color: #666666;
  }

  .name {
    flex: 1;
    font-size: 30rpx;
    color: #333333;
  }
}

.submit-btn {
  display: flex;
  justify-content: center;
  height: 100rpx;
  line-height: 100rpx;
  border-top: 1px solid #f7f7f7;

  .calcel {
    width: 50%;
    line-height: 100rpx;
    text-align: center;
    font-weight: 600;
    font-size: 32rpx;
    color: #666666;
    border-right: 1px solid #f7f7f7;
  }

  .submit {
    width: 50%;
    line-height: 100rpx;
    text-align: center;
    font-weight: 600;
    font-size: 32rpx;
    color: #307dcd;
  }
}

.shop-textarea {
  width: 100%;
  margin: 20rpx auto 40rpx;
  padding: 20rpx 30rpx !important;
  height: 281rpx;
  background: #f7f7f7;
  border-radius: 10rpx;
}

.type-shop-value {
  position: relative;
  padding: 5rpx 5rpx 5rpx 14rpx;
  color: #333;
  font-size: 30rpx;
  border: 1px solid #d8d8d8;
  border-radius: 10rpx;

  .u-icon {
    position: absolute;
    right: 8rpx;
    top: 14rpx;
  }
}

.type-shop-plce {
  position: relative;
  padding: 5rpx 5rpx 5rpx 14rpx;
  color: #666666;
  font-size: 30rpx;
  border: 1px solid #d8d8d8;
  border-radius: 10rpx;

  .u-icon {
    position: absolute;
    right: 8rpx;
    top: 14rpx;
  }
}
</style>
